const exp = require('express'),
    util = require('../utilities'),
    db = require('../db');

const router = exp.Router()

// 处理提问的接口
router.post('/api/ask', util.sign, (req, res) => {
    var petname = req.cookies.petname;
    var time = new Date();
    var count1 = 0
    var count2 = 0
    req.body.petname = petname;
    req.body.time = time;
    req.body.count1 = count1
    req.body.count2 = count2
    db.Question(req.body).save(err => {
        if (err) {
            util.send(res, 'file error', '抱歉，系统错误...');
        } else util.send(res, 'success', '博客发表成功！');
    });
});


module.exports = router